package com.ygxsk.carhome.ui.adapter;

import android.widget.TextView;

import androidx.annotation.Nullable;

import com.blankj.utilcode.util.ObjectUtils;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.viewholder.BaseViewHolder;
import com.ygxsk.carhome.R;
import com.ygxsk.carhome.response.PointListItemBean;
import com.ygxsk.carhome.utils.CommUtils;

import java.util.List;

/**
 * Autuhor:itchen
 * Time:2019/11/14 0014  14:37
 * Description: this is 退货详情之中的适配器内容
 */
public class PointListItemAdapter extends BaseQuickAdapter<PointListItemBean, BaseViewHolder> {

    /**
     * Same as QuickAdapter#QuickAdapter(Context,int) but with
     * some initialization data.
     *
     * @param layoutResId The layout resource id of each item.
     * @param data        A new list is created out of this one to avoid mutable list
     */
    public PointListItemAdapter(int layoutResId, @Nullable List<PointListItemBean> data) {
        super(layoutResId, data);
    }

    /**
     * Implement this method and use the helper to adapt the view to the given item.
     *
     * @param helper            A fully initialized helper.
     * @param pointListItemBean The item that needs to be displayed.
     */
    @Override
    protected void convert(BaseViewHolder helper, PointListItemBean pointListItemBean) {

        if (!ObjectUtils.isEmpty(pointListItemBean)) {

            //一个单独的id 可能有值，可能没有值；
            int pointType = pointListItemBean.getPointType();

            //积分的汉字形式 类型
            String pointTypeInfo = pointListItemBean.getPointTypeInfo();

            //积分的时间
            String pointTime = pointListItemBean.getPointTime();

            //积分增加的类型
            int pointInCrease = pointListItemBean.getPointInCreaseOrDeCrease();

            //积分的 减少的类型
//            int pointDeCrease = pointListItemBean.getPointDeCrease();

            //积分的这个积分的数量
            int pointAmount = pointListItemBean.getPointAmount();


            //查找id的内容
            //这个积分的类别或者名字；
            TextView textViewPointName = (TextView) helper.getView(R.id.textviewpointname);

            //积分时间
            TextView textViewPointNameTime = (TextView) helper.getView(R.id.textviewpointnametime);

            TextView textViewPointAmount = (TextView) helper.getView(R.id.textviewpointamount);

            CommUtils.setText(textViewPointName, pointTypeInfo);
            CommUtils.setText(textViewPointNameTime, pointTime);
            CommUtils.setText(textViewPointAmount, "+" + pointAmount);


//            //合同签约时间的外侧点击事件；
//            LinearLayout layoutAgreenTimeOutSideAdapter = (LinearLayout) helper.getView(R.id.layoutagreentimeoutsideadapter);
//            //合同签约时间的文本填充
//            TextView textViewAgreenTimeAdapter = (TextView) helper.getView(R.id.textviewagreentimeadapter);

//            //合同签约人，文本输入
//            ClearEditText editViewNameAgreenAdapter = (ClearEditText) helper.getView(R.id.editviewnameagreenadapter);
//
//            //合同签约的 价格信息
//            ClearEditText editViewPriceInAgreen = (ClearEditText) helper.getView(R.id.editviewpriceinagreen);
//
//            //填充附件图片的内容
//            MaskProgressLayout mplimageListInAgreenMentAdapter = (MaskProgressLayout) helper.getView(R.id.mplimagelistinagreenmentadapter);


        }

    }
}
